<template>
  <div class="handleButtonGroup">
    <div class="button-container">
      <el-button
        v-if="btnAuth.add"
        type="primary"
        plain
        icon="el-icon-plus"
        size="mini"
        v-on="$listeners"
        @click="handleEventAction('handleAdd')"
        v-hasPermi="[authModule.module + ':' + authModule.name + ':add']"
      >
        新增
      </el-button>
      <el-button
        v-if="btnAuth.edit"
        type="success"
        plain
        icon="el-icon-edit"
        size="mini"
        :disabled="single"
        v-on="$listeners"
        @click="handleEventAction('handleUpdate')"
        v-hasPermi="[authModule.module + ':' + authModule.name + ':edit']"
      >
        修改
      </el-button>
      <el-button
        v-if="btnAuth.delete"
        type="danger"
        plain
        icon="el-icon-delete"
        size="mini"
        :disabled="multiple"
        v-on="$listeners"
        @click="handleEventAction('handleDelete')"
        v-hasPermi="[authModule.module + ':' + authModule.name + ':remove']"
      >
        删除
      </el-button>
      <el-button
        v-if="btnAuth.export"
        type="warning"
        plain
        icon="el-icon-download"
        size="mini"
        v-on="$listeners"
        @click="handleEventAction('handleExport')"
        v-hasPermi="[authModule.module + ':' + authModule.name + ':export']"
      >
        导出
      </el-button>
    </div>
    <right-toolbar v-on="$listeners" @queryTable="handleEventAction('getList')"></right-toolbar>
  </div>
</template>
<script>
export default {
  name: 'HandleButtonGroup',
  inheritAttrs: false,
  props: {
    authModule: {
      type: Object,
      default: () => {
        return {
          module: 'gen',
          name: 'user',
        };
      },
    },
    btnAuth: {
      type: Object,
      default: () => {
        return {
          add: true,
          edit: false,
          delete: true,
          export: true,
        };
      },
    },
    single: {
      type: Boolean,
      default: true,
    },
    multiple: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {};
  },
  methods: {
    handleEventAction(eventName, params) {
      this.$emit(eventName, params);
    },
  },
};
</script>
<style lang="scss" scoped>
.handleButtonGroup {
  display: flex;
  justify-content: space-between;
  .button-container {
    & >>> .el-button + .el-button {
      margin-right: 15px;
    }
  }
}
</style>
